#ifndef RENDERMANAGER_H
#define RENDERMANAGER_H
#include "includes.h"
#include "chunkmanager.h"
#include "cameramanager.h"
#include "MouseUtils.h"

class RenderManager
{
    ChunkManager Chunks;

    RenderManager();
public:
    CameraManager Camera;
    static RenderManager* getInstance();
    MouseUtils mouseUtils;

    void Render();
    voxel& getVoxel(int x, int y, int z);
    void addVoxel(int x, int y, int z, voxel& v);
    void removeVoxel(int x, int y, int z);
    void setVoxelColor(int x, int y, int z, colour& c);
    colour& getVoxelColor(int x, int y, int z);
    bool isVoxelValid(int x, int y, int z);
    bool isVoxelDrawn(int x, int y, int z);
};

inline
bool RenderManager::isVoxelValid(int x, int y, int z){
    return Chunks.isValid(x,y,z);
}

inline
bool RenderManager::isVoxelDrawn(int x, int y, int z){
    return Chunks.isValid(x,y,z) && Chunks.getVoxel(x,y,z).draw();
}

inline
colour& RenderManager::getVoxelColor(int x, int y, int z){
    return Chunks.getVoxel(x,y,z).getColor();
}

inline
void RenderManager::setVoxelColor(int x, int y, int z, colour &c){
    Chunks.setVoxelColor(x,y,z,c);
}

inline
voxel& RenderManager::getVoxel(int x, int y, int z){
    return Chunks.getVoxel(x,y,z);
}

inline
void RenderManager::addVoxel(int x, int y, int z, voxel& v){
    Chunks.addVoxel(x,y,z,v);
}

inline
void RenderManager::removeVoxel(int x, int y, int z){
    Chunks.removeVoxel(x,y,z);
}

#endif // RENDERMANAGER_H
